Integrand size = 26, antiderivative size = 136 \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {2 a \left (a^2+2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} d}-\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\left (a^2+2 b^2-3 a b \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d} \]
[Out]
Time = 0.35 (sec) , antiderivative size = 136, normalized size of antiderivative = 1.00, number of steps used = 6, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {4482, 2943, 2945, 12, 2738, 214} \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {2 a \left (a^2+2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{d (a-b)^{5/2} (a+b)^{5/2}}-\frac {\csc (c+d x) \left (a^2-3 a b \cos (c+d x)+2 b^2\right )}{d \left (a^2-b^2\right )^2}-\frac {b \csc (c+d x)}{d \left (a^2-b^2\right ) (a \cos (c+d x)+b)} \]
[In]
[Out]
Rule 12
Rule 214
Rule 2738
Rule 2943
Rule 2945
Rule 4482
Rubi steps \begin{align*} \text {integral}& = \int \frac {\cot (c+d x) \csc (c+d x)}{(b+a \cos (c+d x))^2} \, dx \\ & = -\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\int \frac {(-a+2 b \cos (c+d x)) \csc ^2(c+d x)}{b+a \cos (c+d x)} \, dx}{a^2-b^2} \\ & = -\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\left (a^2+2 b^2-3 a b \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d}+\frac {\int \frac {a \left (a^2+2 b^2\right )}{b+a \cos (c+d x)} \, dx}{\left (a^2-b^2\right )^2} \\ & = -\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\left (a^2+2 b^2-3 a b \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d}+\frac {\left (a \left (a^2+2 b^2\right )\right ) \int \frac {1}{b+a \cos (c+d x)} \, dx}{\left (a^2-b^2\right )^2} \\ & = -\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\left (a^2+2 b^2-3 a b \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d}+\frac {\left (2 a \left (a^2+2 b^2\right )\right ) \text {Subst}\left (\int \frac {1}{a+b+(-a+b) x^2} \, dx,x,\tan \left (\frac {1}{2} (c+d x)\right )\right )}{\left (a^2-b^2\right )^2 d} \\ & = \frac {2 a \left (a^2+2 b^2\right ) \text {arctanh}\left (\frac {\sqrt {a-b} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a+b}}\right )}{(a-b)^{5/2} (a+b)^{5/2} d}-\frac {b \csc (c+d x)}{\left (a^2-b^2\right ) d (b+a \cos (c+d x))}-\frac {\left (a^2+2 b^2-3 a b \cos (c+d x)\right ) \csc (c+d x)}{\left (a^2-b^2\right )^2 d} \\ \end{align*}
Time = 1.45 (sec) , antiderivative size = 127, normalized size of antiderivative = 0.93 \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=-\frac {\frac {4 a \left (a^2+2 b^2\right ) \text {arctanh}\left (\frac {(-a+b) \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{5/2}}+\frac {\cot \left (\frac {1}{2} (c+d x)\right )}{(a+b)^2}+\frac {\frac {2 a^2 b \sin (c+d x)}{(a+b)^2 (b+a \cos (c+d x))}+\tan \left (\frac {1}{2} (c+d x)\right )}{(a-b)^2}}{2 d} \]
[In]
[Out]
Time = 3.59 (sec) , antiderivative size = 162, normalized size of antiderivative = 1.19
method | result | size |
derivativedivides | \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a^{2}-2 a b +b^{2}\right )}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 a \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b}-\frac {\left (a^{2}+2 b^{2}\right ) \operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) | \(162\) |
default | \(\frac {-\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{2 \left (a^{2}-2 a b +b^{2}\right )}-\frac {1}{2 \left (a +b \right )^{2} \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}-\frac {2 a \left (-\frac {a b \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} a -\tan \left (\frac {d x}{2}+\frac {c}{2}\right )^{2} b -a -b}-\frac {\left (a^{2}+2 b^{2}\right ) \operatorname {arctanh}\left (\frac {\tan \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (a -b \right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\sqrt {\left (a +b \right ) \left (a -b \right )}}\right )}{\left (a -b \right )^{2} \left (a +b \right )^{2}}}{d}\) | \(162\) |
risch | \(-\frac {2 i \left (a^{3} {\mathrm e}^{3 i \left (d x +c \right )}+2 a \,b^{2} {\mathrm e}^{3 i \left (d x +c \right )}+a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+a^{3} {\mathrm e}^{i \left (d x +c \right )}-4 a \,b^{2} {\mathrm e}^{i \left (d x +c \right )}-3 a^{2} b \right )}{\left ({\mathrm e}^{2 i \left (d x +c \right )} a +2 b \,{\mathrm e}^{i \left (d x +c \right )}+a \right ) \left (-a^{2}+b^{2}\right )^{2} \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) d}+\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}+\frac {2 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}+\frac {i a^{2}-i b^{2}+\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {a^{3} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}-\frac {2 b^{2} a \ln \left ({\mathrm e}^{i \left (d x +c \right )}-\frac {i a^{2}-i b^{2}-\sqrt {a^{2}-b^{2}}\, b}{a \sqrt {a^{2}-b^{2}}}\right )}{\sqrt {a^{2}-b^{2}}\, \left (a +b \right )^{2} \left (a -b \right )^{2} d}\) | \(487\) |
[In]
[Out]
none
Time = 0.29 (sec) , antiderivative size = 532, normalized size of antiderivative = 3.91 \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\left [-\frac {4 \, a^{4} b - 2 \, a^{2} b^{3} - 2 \, b^{5} - {\left (a^{3} b + 2 \, a b^{3} + {\left (a^{4} + 2 \, a^{2} b^{2}\right )} \cos \left (d x + c\right )\right )} \sqrt {a^{2} - b^{2}} \log \left (\frac {2 \, a b \cos \left (d x + c\right ) - {\left (a^{2} - 2 \, b^{2}\right )} \cos \left (d x + c\right )^{2} + 2 \, \sqrt {a^{2} - b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )} \sin \left (d x + c\right ) + 2 \, a^{2} - b^{2}}{a^{2} \cos \left (d x + c\right )^{2} + 2 \, a b \cos \left (d x + c\right ) + b^{2}}\right ) \sin \left (d x + c\right ) - 6 \, {\left (a^{4} b - a^{2} b^{3}\right )} \cos \left (d x + c\right )^{2} + 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (d x + c\right )}{2 \, {\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}, -\frac {2 \, a^{4} b - a^{2} b^{3} - b^{5} - {\left (a^{3} b + 2 \, a b^{3} + {\left (a^{4} + 2 \, a^{2} b^{2}\right )} \cos \left (d x + c\right )\right )} \sqrt {-a^{2} + b^{2}} \arctan \left (-\frac {\sqrt {-a^{2} + b^{2}} {\left (b \cos \left (d x + c\right ) + a\right )}}{{\left (a^{2} - b^{2}\right )} \sin \left (d x + c\right )}\right ) \sin \left (d x + c\right ) - 3 \, {\left (a^{4} b - a^{2} b^{3}\right )} \cos \left (d x + c\right )^{2} + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} \cos \left (d x + c\right )}{{\left ({\left (a^{7} - 3 \, a^{5} b^{2} + 3 \, a^{3} b^{4} - a b^{6}\right )} d \cos \left (d x + c\right ) + {\left (a^{6} b - 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} - b^{7}\right )} d\right )} \sin \left (d x + c\right )}\right ] \]
[In]
[Out]
\[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\int \frac {\sec {\left (c + d x \right )}}{\left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2}}\, dx \]
[In]
[Out]
Exception generated. \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\text {Exception raised: ValueError} \]
[In]
[Out]
Leaf count of result is larger than twice the leaf count of optimal. 288 vs. \(2 (128) = 256\).
Time = 0.45 (sec) , antiderivative size = 288, normalized size of antiderivative = 2.12 \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=-\frac {\frac {4 \, {\left (a^{3} + 2 \, a b^{2}\right )} {\left (\pi \left \lfloor \frac {d x + c}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a - 2 \, b\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\sqrt {-a^{2} + b^{2}}}\right )\right )}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} \sqrt {-a^{2} + b^{2}}} + \frac {\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{a^{2} - 2 \, a b + b^{2}} + \frac {a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 7 \, a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 3 \, a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - a^{3} + a^{2} b + a b^{2} - b^{3}}{{\left (a^{4} - 2 \, a^{2} b^{2} + b^{4}\right )} {\left (a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}}{2 \, d} \]
[In]
[Out]
Time = 23.15 (sec) , antiderivative size = 245, normalized size of antiderivative = 1.80 \[ \int \frac {\sec (c+d x)}{(a \sin (c+d x)+b \tan (c+d x))^2} \, dx=\frac {\frac {a^2-2\,a\,b+b^2}{a+b}-\frac {{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2\,\left (a^3-7\,a^2\,b+3\,a\,b^2-b^3\right )}{{\left (a+b\right )}^2}}{d\,\left (\left (2\,a^3-6\,a^2\,b+6\,a\,b^2-2\,b^3\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (-2\,a^3+2\,a^2\,b+2\,a\,b^2-2\,b^3\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )}-\frac {\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{2\,d\,{\left (a-b\right )}^2}-\frac {a\,\mathrm {atan}\left (\frac {1{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^4-2{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,a^2\,b^2+1{}\mathrm {i}\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,b^4}{{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{3/2}}\right )\,\left (a^2+2\,b^2\right )\,2{}\mathrm {i}}{d\,{\left (a+b\right )}^{5/2}\,{\left (a-b\right )}^{5/2}} \]
[In]
[Out]